home *** CD-ROM | disk | FTP | other *** search
- #!/bin/vtcl
- # This is the complete application that appeared in the
- # SCOWorld Magazine, April 1995...
-
- # This callback disconnects the script from the Visual Tcl
- # display engine; then exits the vtcl interpreter.
- # All callbacks receive widget info via a parameter, but
- # we'll ignore it here.
- proc CloseCB {cbs} {
- VtClose
- exit 0
- }
-
- # Using the widget name of the radio box, grab the
- # short name to determine the minimum file size.
- # Return that value.
- proc GetMinFileSize {} {
- global rbox
- set toggleWidget [VtGetValues $rbox -value]
- return [VxGetShortName $toggleWidget]
- }
-
- # Exec the find command to grab a list of files that
- # exceeds the minimum file size indicated by the user.
- # Update the list widget with the file list when the
- # find command is completed.
- proc PerformFindCB {cbs} {
- global listW
- set sizeValue [GetMinFileSize]
-
- # Turn the cursor into a watch to prevent the user
- # from pushing more buttons during the execution of find.
- #
- VtLock
- set result [exec find [pwd] -type f -size +${sizeValue} -print]
- VtUnLock
-
- # Post a message if there are no files larger
- # than sizeValue located.
- if { [llength $result] == 0 } {
- set parentDialog [keylget cbs dialog]
- set infoForm [VtInformationDialog $parentDialog.infoForm \
- -message "No Files Found" \
- -ok \
- ]
- VtShow $infoForm
- }
- VtSetValues $listW -itemList $result
- }
-
- # Connect to the Visual Tcl display engine.
- set app [VtOpen findtool]
-
- # Build the main dialog.
- # (the -cancelButton maps one of the dialog buttons to the Escape key)
- set dlog [VtFormDialog $app.dlog \
- -title "The Find Tool" \
- -okLabel "Begin Find" \
- -okCallback PerformFindCB \
- -wmCloseCallback CloseCB \
- -cancelCallback CloseCB \
- -cancelLabel Quit \
- -cancelButton CANCEL \
- ]
-
- set listW [VtList $dlog.list \
- -rows 10 \
- -bottomSide FORM \
- ]
-
- set labelW [VtLabel $dlog.label \
- -label "Minimum Fize Sizes\nto Search" \
- -leftSide $listW \
- -alignTop $listW \
- -rightSide FORM \
- ]
- set rbox [VtRadioBox $dlog.rbox \
- -topSide $labelW \
- -leftSide $listW \
- -rightSide FORM \
- ]
-
- # Create the size options to list inside the radio box.
- # Compensate for the 512K blocks size conversion.
- VtToggleButton $rbox.200K -label "100 K"
- VtToggleButton $rbox.1000K -label "500 K"
- VtToggleButton $rbox.2000K -label "1 Megabyte" -set 1
-
- VtShow $dlog
- VtMainLoop
-